namespace BM.Tools.WebControls.MForm.Navigation.XPath.NodeTests
{
    using System;

    /// <summary>
    /// A definition of a node test that matches a specified attribute.
    /// </summary>
    public class AttributeTest : NodeTest
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AttributeTest"/> class. 
        /// </summary>
        /// <param name="attributeName">
        /// The attributeName.
        /// </param>
        public AttributeTest(string attributeName)
        {
            Name = attributeName;
        }

        /// <summary>
        /// Gets the name of the attribute.
        /// </summary>
        /// <value>
        /// The attribute name.
        /// </value>
        public string Name
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the text representation of the node test.
        /// </summary>
        /// <value>
        /// The text in which the node test can be represented in xpath - @(name).
        /// </value>
        public override string Text
        {
            get
            {
                return String.Concat("@", Name);
            }
        }
    }
}